exports.searchDocs = function (req, res) {

    //获取接口分类列表
    function searchCategoryData(cb){

        var sql = "select * from docs_category";

        sqliteDb.all(sql,function(err,data){

            if(err){
                return RES.errorResponse(res,"抱歉，文档分类获取失败");
            }
                
            menuData = data;

            cb();
           
        });

    }

    //获取每个分类下的接口信息
    function searchDocsData(cb){

        function taskFun(item,index,callback){

            var sql = "select d_id,d_name from docs where d_dcid = " + item.dc_id;

            sqliteDb.all(sql,function(error,data){

                if(error){
                    console.log("文档获取失败");
                }
    
                item.docsData = data;

                callback();

            });

        }

        //创建循环
        F.SerialEach(menuData,taskFun,function(){
            cb();
        });
        
    }

    F.Serial([searchCategoryData,searchDocsData],function(){

        Render.viewRender(req,res,'searchDocs',{title:"查询文档页",menuData:menuData})
        
    });

    
    
}